package com.example.demo.service;

import java.util.List;

import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.example.demo.dao.UserDao;
import com.example.demo.entity.User;
import com.example.demo.entity.query.UserQuery;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;

@Service
public class UserServiceImpl implements UserService {

	@Autowired
	private UserDao userDao;
	
	@Override
	public List<User> SelectAll() {

		return userDao.SelectAll();
	}

	@Override
	public PageInfo<User> SelectByName(UserQuery userQuery) {

		PageHelper.startPage(userQuery.getPageNum(), userQuery.getPageSize());
		return new PageInfo<User>(userDao.SelectByName(userQuery));
	}

	@Override
	public boolean DeleteById(Integer id) {

		if (userDao.DeleteById(id)>0) {
			return true;
		}else {
			return false;
		}

	}
	

	

}
